#include<iostream>
using namespace std;

bool shellsort(int a[], int len)
{
	if (len == 0 || len < 2)
	{
		return true;
	}
	for (int gap = len / 2; gap >= 1; gap = gap / 2)
	{
		for (int i = gap; i < len; i++)
		{
			for (int j = i - gap; j >= 0 && a[j] > a[j + gap]; j--)
			{
				int tmp;
				tmp = a[j + gap];
				a[j + gap] = a[j];
				a[j] = tmp;
			}
		}
	}
	return true;
}
int main()
{
	int a[] = { 2,3,5,11,43,75,65,82,99,10 ,23,331,231,34,1,31414,324,52,123,4,34,223,1313};
	int len = sizeof(a) / sizeof(int);
	shellsort(a,len);
	
	for (int i = 0; i < len; i++)
	{
		cout << a[i] << " ";
	}
	return 0;
}